package k2_oop.p6_relation.demo09;

import java.util.Scanner;

/**
 * 定义PayrollSystem类，创建Employee变量数组并初始化，该数组存放各类雇员对象的引用。
 * 利用循环结构遍历数组元素，输出各个对象的类型,name,number,birthday,以及该对象生日。
 * 当键盘输入本月月份值时，如果本月是某个Employee对象的生日，还要输出增加工资信息
 */
public class PayrollSystem {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int month;

        Employee[] employees = {
            new SalariedEmployee("张三","101",new MyDate(2000,1,1),10000),
            new HourlyEmployee("李四","201",new MyDate(1999,12,31),20,8),
            new SalariedEmployee("王二麻子","102",new MyDate(1998,8,8),8000),
            new HourlyEmployee("李狗蛋","202",new MyDate(2001,4,5),10,10),
            new HourlyEmployee("狗剩子","203",new MyDate(2000,9,8),100,5)
        };

        for (Employee employee : employees) {
            employee.display();
            System.out.println("请输入当前月份:");
            month = scanner.nextInt();
            System.out.println(employee.earnings(month));

        }

    }

}
